// Copyright (c) 2023 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//    * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//    * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//    * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=9ebba0d75e26b973f242563f58081b9f0e97ad53$
//

#ifndef CEF_INCLUDE_CAPI_CEF_PERMISSION_REQUEST_CAPI_H_
#define CEF_INCLUDE_CAPI_CEF_PERMISSION_REQUEST_CAPI_H_
#pragma once

#include "include/capi/cef_base_capi.h"
#include "include/internal/cef_types.h"

#ifdef __cplusplus
extern "C" {
#endif

///
// Structure used to report permission request for the specified origin.
///
typedef struct _cef_access_request_t {
  ///
  // Base structure.
  ///
  cef_base_ref_counted_t base;

  ///
  // Get the origin that is trying to acess the resource.
  ///
  // The resulting string must be freed by calling cef_string_userfree_free().
  cef_string_userfree_t(CEF_CALLBACK* origin)(
      struct _cef_access_request_t* self);

  ///
  // Get the resource that the origin is trying to acess.
  ///
  int(CEF_CALLBACK* resource_acess_id)(struct _cef_access_request_t* self);

  ///
  // Report whether the origin is allowed to acess the resource.
  ///
  void(CEF_CALLBACK* report_request_result)(struct _cef_access_request_t* self,
                                            int allowed);
} cef_access_request_t;

///
// Structure used to report screen capture permission request for the specified
// origin.
///
typedef struct _cef_screen_capture_access_request_t {
  ///
  // Base structure.
  ///
  cef_base_ref_counted_t base;

  ///
  // Get the origin that is trying to acess the resource.
  ///
  // The resulting string must be freed by calling cef_string_userfree_free().
  cef_string_userfree_t(CEF_CALLBACK* origin)(
      struct _cef_screen_capture_access_request_t* self);

  ///
  // Set screen capture mode. {@link #cef_screen_capture_mode_t}
  ///
  void(CEF_CALLBACK* set_capture_mode)(
      struct _cef_screen_capture_access_request_t* self,
      int32_t mode);

  ///
  // Set screen capture source id.
  ///
  void(CEF_CALLBACK* set_capture_source_id)(
      struct _cef_screen_capture_access_request_t* self,
      int32_t sourceId);

  ///
  // Report whether the origin is allowed to acess the resource.
  ///
  void(CEF_CALLBACK* report_request_result)(
      struct _cef_screen_capture_access_request_t* self,
      int allowed);
} cef_screen_capture_access_request_t;

///
// Implement this structure to handle permission requests.
///
typedef struct _cef_permission_request_t {
  ///
  // Base structure.
  ///
  cef_base_ref_counted_t base;

  ///
  // Notify the host application that web content from the specified origin is
  // attempting to use the Geolocation API, but no permission state is currently
  // set for that origin. The host application should invoke the specified
  // callback with the desired permission state.
  ///
  void(CEF_CALLBACK* on_geolocation_show)(
      struct _cef_permission_request_t* self,
      const cef_string_t* origin);

  ///
  // Revert the operation in the OnGeolocationShow.
  ///
  void(CEF_CALLBACK* on_geolocation_hide)(
      struct _cef_permission_request_t* self);

  ///
  // Notify the host application that web content from the specified origin is
  // attempting to access the resources, but no permission state is currently
  // set for that origin. The host application should invoke the specified
  // callback with the desired permission state.
  ///
  void(CEF_CALLBACK* on_permission_request)(
      struct _cef_permission_request_t* self,
      struct _cef_access_request_t* request);

  ///
  // Revert the operation in the OnPermissionRequest.
  ///
  void(CEF_CALLBACK* on_permission_request_canceled)(
      struct _cef_permission_request_t* self,
      struct _cef_access_request_t* request);

  ///
  // Notify the host application that web content from the specified origin is
  // attempting to access the screen capture resources, but no permission state
  // is currently set for that origin. The host application should invoke the
  // specified callback with the desired permission state.
  ///
  void(CEF_CALLBACK* on_screen_capture_request)(
      struct _cef_permission_request_t* self,
      struct _cef_screen_capture_access_request_t* request);
} cef_permission_request_t;

///
// Structure used to handle the permission requests from |BrowserContext|.
///
typedef struct _cef_browser_permission_request_delegate_t {
  ///
  // Base structure.
  ///
  cef_base_ref_counted_t base;

  ///
  // Handle the Geolocation permission requests.
  ///
  void(CEF_CALLBACK* ask_geolocation_permission)(
      struct _cef_browser_permission_request_delegate_t* self,
      const cef_string_t* origin,
      cef_permission_callback_t callback);

  ///
  // Cancel the Geolocation permission requests.
  ///
  void(CEF_CALLBACK* abort_ask_geolocation_permission)(
      struct _cef_browser_permission_request_delegate_t* self,
      const cef_string_t* origin);

  ///
  // Handle the Protected Media Identifier permission requests.
  ///
  void(CEF_CALLBACK* ask_protected_media_identifier_permission)(
      struct _cef_browser_permission_request_delegate_t* self,
      const cef_string_t* origin,
      cef_permission_callback_t callback);

  ///
  // Cancel the Protected Media Identifier permission requests.
  ///
  void(CEF_CALLBACK* abort_ask_protected_media_identifier_permission)(
      struct _cef_browser_permission_request_delegate_t* self,
      const cef_string_t* origin);

  ///
  // Handle the MIDI Sysex permission requests.
  ///
  void(CEF_CALLBACK* ask_midisysex_permission)(
      struct _cef_browser_permission_request_delegate_t* self,
      const cef_string_t* origin,
      cef_permission_callback_t callback);

  ///
  // Cancel the MIDI Sysex permission requests.
  ///
  void(CEF_CALLBACK* abort_ask_midisysex_permission)(
      struct _cef_browser_permission_request_delegate_t* self,
      const cef_string_t* origin);

  ///
  // The callback for the Geolocation permission requests.
  ///
  void(CEF_CALLBACK* notify_geolocation_permission)(
      struct _cef_browser_permission_request_delegate_t* self,
      int value,
      const cef_string_t* origin);
} cef_browser_permission_request_delegate_t;

///
// Structure used to set the geolocation permission state for the specified
// origin.
///
typedef struct _cef_geolocation_acess_t {
  ///
  // Base structure.
  ///
  cef_base_ref_counted_t base;

  ///
  // Return true (1) if the geolocation permission state is set for the
  // specified origin.
  ///
  int(CEF_CALLBACK* contain_origin)(struct _cef_geolocation_acess_t* self,
                                    const cef_string_t* origin);

  ///
  // Return true (1) if the geolocation permission state set for the specified
  // origin is true (1).
  ///
  int(CEF_CALLBACK* is_origin_access_enabled)(
      struct _cef_geolocation_acess_t* self,
      const cef_string_t* origin);

  ///
  // Set the geolocation permission state to true (1)  for the specified origin.
  ///
  void(CEF_CALLBACK* enabled)(struct _cef_geolocation_acess_t* self,
                              const cef_string_t* origin);

  ///
  // Set the geolocation permission state to false (0)  for the specified
  // origin.
  ///
  void(CEF_CALLBACK* disabled)(struct _cef_geolocation_acess_t* self,
                               const cef_string_t* origin);
} cef_geolocation_acess_t;

#ifdef __cplusplus
}
#endif

#endif  // CEF_INCLUDE_CAPI_CEF_PERMISSION_REQUEST_CAPI_H_
